﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MathLib;

namespace TrackingSim.Filtering.Kinematics
{
    public abstract class KinematicState
    {
        int num_states;
        double time;
        Vector state;
        Matrix covariance;

        public KinematicState(double _time, int _num_states)
        {
            num_states = _num_states;
            time = _time;
            state = new Vector(_num_states);
            covariance = new Matrix(_num_states, _num_states);
        }

        public virtual KinematicState clone()
        {
            return null;
        }

        public int Num_States
        {
            get { return num_states; }
        }

        public double Time
        {
            get { return time; }
            set { time = value; }
        }

        public Vector State
        {
            get { return state; }
            set 
            {
                if (state.N == value.N)
                {
                    state = value;
                }
                else
                {
                    throw new InvalidOperationException("Vector lengths do not agree.");
                }
            }
        }

        public Matrix Cov
        {
            get { return covariance; }
            set
            {
                if ((covariance.Cols == value.Cols)
                    &&
                    (covariance.Rows == value.Rows))
                {
                    covariance = value;
                }
                else
                {
                    throw new InvalidOperationException("Matrix dimensions do not agree.");
                }
            }
        }
    }
}
